package com.baogu.database.controller;

import com.baogu.database.service.ControllerStatusService;
import com.baogu.model.common.HttpResult;
import com.baogu.model.database.ControllerStatus;
import com.baogu.model.database.where.ControllerStatusWhere;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 控制器状态接口
 */
@RestController
@RequestMapping("/controllerStatus")
public class ControllerStatusController {

    @Autowired
    ControllerStatusService controllerStatusService;

    @GetMapping("/allList/{pageNum}/{pageSize}")
    public HttpResult allList(@PathVariable("pageNum") Integer pageNum,@PathVariable("pageSize") Integer pageSize){
        PageHelper.startPage(pageNum,pageSize);
        List<ControllerStatus> list = controllerStatusService.allList(new ControllerStatusWhere());
        PageInfo<ControllerStatus> pageInfo = new PageInfo<>(list);
        return HttpResult.OK(pageInfo);
    }
}
